{% extends "layout.html" %}
{% block content %}

<div class="row-fluid" style="margin-top: 20px;">
  <div class="span6">
    <div class="widget">
      <div class="widget-header">
        <h3>Dishes you have served</h3>
      </div>
      <div class="widget-content">
        <div class="widget-nomargin">
          {% if all_my_food %}
          <table class="hirein-widget-full-table">
            <thead>
            <th>Name</th>
            <th></th>
            </thead>
            <tbody>
            {% for f in all_my_food %}
            <tr>
              <td>{{ f.name }}</td>
              <td>
                <form class="form-inline" action="{{ url_for('admin_add_existing_food') }}" method="POST">
                  {{ exform.food_id(type="hidden",value= f.id)}}
                  {{ exform.submit(class="btn btn-primary pull-right")}}
                  {{ exform.quantities(placeholder = "Quantity", class="pull-right", style="width:60px;margin-right:5px;")}}
                </form>
              </td>
            </tr>
            {% endfor %}
            </tbody>
          </table>
          {% else %}
            <p style="padding:15px 10px;">You have no food in your inventory.</p>
          {% endif %}
        </div>
      </div>
    </div>
  </div>
  <div class="span6">
    <div class="widget">
      <div class="widget-header">
        <h3>Today's menu</h3>
      </div>
      <div class="widget-content">
        <div class="widget-nomargin">
          {% if current_menu %}
          <table class="hirein-widget-full-table">
            <thead>
              <th>Food</th>
              <th>Quantity</th>
              <th>Stock</th>
              <th>In process</th>
              <th>&nbsp;</th>
            </thead>
            <tbody>
            {% for d in current_menu %}
            <form action="{{ url_for('admin_remove_menu_item') }}" method="POST">
              <tr>
                {{ removeForm.food_id(type="hidden", value= d.id)}}
                <td>{{d.id}} {{ d.food.name }}</td>
                <td>{{ d.max_quantity }}</td>
                <td>{{ d.remaining_orders() }}</td>
                <td>{{ d.orders_in_queue() }}</td>
                <td>
                  {% if d.orders_in_queue() > 0 %}
                    {{ removeForm.submit(class="btn btn-inverse pull-right", disabled="disabled")}}
                  {% else %}
                    {{ removeForm.submit(class="btn btn-danger pull-right")}}
                  {% endif %}
                </td>
              </tr>
            </form>
            {% endfor %}
            <form action="{{ url_for('admin_add_menu_item') }}" method="POST">
              <tr>
                <td colspan="5">{{ form.food_name(placeholder = "Add new food item")}}
                {{ form.max_quantities(placeholder = "Quantity")}}
                {{ form.submit(class="btn btn-primary pull-right")}}</td>
              </tr>
            </form>
            </tbody>
          </table>
          {% else %}
          <p style="padding: 15px 10px;">There are no orders ready for pick up. Try refreshing the page frequently.</p>
          {% endif %}
        </div>
      </div>
    </div>
  </div>

</div>
{% endblock %}